<template>
    <div>
      learn-index
      <br>
      <input type="text" v-model="tagName"> <button @click="addTagName">点击添加标签</button>

      <br>
      <input type="text" v-model="tagKeyWords"> 标签关键词 <br>
      <input type="text" v-model="tagCurrent"> 标签当前页 <br>
      <input type="text" v-model="tagSize"> 标签每页大小 <br>
      <button @click="searchTagInfoList">查询标签信息</button>
    </div>
</template>

<script>
  import qs from "querystring";
  //引入http
  // import axios from "../../utils/http/http";
  export default {
    name: "learn-index",
    data() {
      return {
        tagName: '',
        tagKeyWords: '',
        tagCurrent: 1,
        tagSize: 3
      }
    },
    methods: {
      //请求接口，添加标签
      addTagName() {
        // axios.post('/res/tag/add', {
        //   tagName: this.tagName
        // })
        this.$api.banner.addTagInfo({tagName: this.tagName})
        .then(function (response) {
          console.log(response.data);
        })
        .catch(function (error) {
          console.log(error);
        });
      },
      //查询标签信息
      searchTagInfoList() {
        // axios.get('/res/tag/pageList', {
        //   params: {
        //     tagName: this.tagKeyWords,
        //     current: this.tagCurrent,
        //     size: this.tagSize
        //   }
        // })
        this.$api.banner.getTagList({
          tagName: this.tagKeyWords,
          current: this.tagCurrent,
          size: this.tagSize
        })
        .then(function (response) {
          console.log(response.data.data);
        })
        .catch(function (error) {
          console.log(error);
        });
      }
    },
    mounted() {
      // axios.get('/hello-world/tree')
      this.$api.banner.getHelloWorldTree()
      .then(function (response) {
        console.log(response);
      })
      .catch(function (error) {
        console.log(error);
      });
    }
  }
</script>

<style scoped>

</style>
